package com.example.tpintegrador;

import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TabHost;
import com.example.tpintegrador.R;

public class RegistroActivity extends TabActivity {
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.historial_contacto);
        
        TabHost tabHost= getTabHost();
        TabHost.TabSpec spec;
        Intent intent;
        Resources res= getResources();
        
        intent= new Intent().setClass(this, RegistroLlamadas.class);
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
        	Bundle bundle = new Bundle();
        	bundle.putString("idContacto",extras.getString("id"));
			bundle.putString("nombreContacto",extras.getString("nombre"));
			bundle.putString("fotoContacto", extras.getString("foto"));
			intent.putExtras(bundle);
        }
        spec=tabHost.newTabSpec("RegistroLlamadas").setIndicator("Llamadas", res.getDrawable(R.drawable.registro_llamadas_imagenes)).setContent(intent);
        tabHost.addTab(spec);
        
        intent= new Intent().setClass(this, RegistroEmails.class);
		if (extras != null) {
			Bundle bundle = new Bundle();
			bundle.putString("idContacto",extras.getString("id"));
			bundle.putString("nombreContacto",extras.getString("nombre"));
			bundle.putString("fotoContacto", extras.getString("foto"));
			intent.putExtras(bundle);
			
		} 
        spec=tabHost.newTabSpec("RegistroEmails").setIndicator("Email", res.getDrawable(R.drawable.registro_emails_imagenes)).setContent(intent);
        tabHost.addTab(spec);
        

        intent= new Intent().setClass(this, RegistroMensajes.class);
        if (extras != null) {
        	Bundle bundle = new Bundle();
        	bundle.putString("idContacto",extras.getString("id"));
			bundle.putString("nombreContacto",extras.getString("nombre"));
			bundle.putString("fotoContacto", extras.getString("foto"));
			intent.putExtras(bundle);
        }
        spec=tabHost.newTabSpec("RegistroMensajes").setIndicator("SMS", res.getDrawable(R.drawable.registro_mensajes_imagenes)).setContent(intent);
        tabHost.addTab(spec);
        
        intent= new Intent().setClass(this, RegistroServWeb.class);
        if (extras != null) {
        	Bundle bundle = new Bundle();
        	bundle.putString("idContacto",extras.getString("id"));
			bundle.putString("nombreContacto",extras.getString("nombre"));
			bundle.putString("fotoContacto", extras.getString("foto"));
			intent.putExtras(bundle);
        }
        spec=tabHost.newTabSpec("RegistroServWeb").setIndicator("Servidor Web", res.getDrawable(R.drawable.registro_serv_web_imagenes)).setContent(intent);
        tabHost.addTab(spec);
        
	}
	
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.registro_menu, menu);
		return true;
	}
	
	public boolean onOptionsItemSelected(MenuItem item) {
		Intent intent;
		intent = new Intent(this, PreferenciaRegistro.class);
		startActivity(intent);
		return true;

	}

}
